@echo off
echo Building ONNX Runtime library...

if not exist onnxruntime\build mkdir onnxruntime\build

cd onnxruntime\build

cmake ..

if %ERRORLEVEL% EQU 0 (
    echo CMake configuration successful!
    echo Building project...
    cmake --build . --config Release
    
    if %ERRORLEVEL% EQU 0 (
        echo Build successful!
        cd ..\..
        call setup_libraries.bat
    ) else (
        echo Build failed!
        cd ..\..
        exit /b 1
    )
) else (
    echo CMake configuration failed!
    cd ..\..
    exit /b 1
)